<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
    <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>


<c:choose>
<c:when test="${sessionScope.admin==null}">
	<script type="text/javascript">
	$(document).ready(function(){
		if(${sessionScope.admin==null}){
			alert("로그인 후 이용 가능합니다.");
			location.href="admin.do";
		}
	});
</script>	
</c:when>
<c:otherwise>
<h1>공지사항</h1>
<font size="2">
회원님께서 Where is my Teacher를 편리하게 이용할 수 있도록 알려드리고 있습니다.
<br>
이용에 불편이 없도록 공지사항을 확인하세요.
</font>
<br>
<br>
<center>
<table bordercolor="lightgrey" style="border-width: 0.5mm;" bgcolor="#F8F8F8">
	<thead>
	<tr bgcolor="#E6E6E6">
	<td align="center"><font size="2">번호</font></td>
	<td align="center" width="250"><font size="2">제목</font></td>
	<td align="center"><font size="2">작성자</font></td>
	<td align="center" width="150"><font size="2">작성일</font></td>
	<td align="center"><font size="2">조회수</font></td>
	</tr>
	</thead>
	<tbody>
	<c:forEach items="${requestScope.list.list }" var="list">
	<tr>
	<td align="center"><font size="2">${list.no }</font></td>
	<td><a href="showNoticeInfoForAdmin.do?no=${list.no }"><font size="2">${list.title }</font></a></td>
	<td align="center"><font size="2">${list.writer }</font></td>
	<td align="center"><font size="2">${list.datePosted }</font></td>
	<td align="center"><font size="2">${list.hits }</font></td>
	</tr>
	</c:forEach>
	</tbody>
</table>

<table>
<tr>
<td width="1000" align="right">
<a href="writeNoticePageForAdmin.do"><input type="button" value="글쓰기"></a>
</td>
</tr>
</table>


<br>

<c:if test="${requestScope.list.pagingBean.previousPageGroup }">
<a href="noticeList.doForAdmin?pageNo=${requestScope.list.pagingBean.startPageOfPageGroup-1}">◀</a>
</c:if>
&nbsp;&nbsp;
<c:forEach var="i" 
begin="${requestScope.list.pagingBean.startPageOfPageGroup}"
end="${requestScope.list.pagingBean.endPageOfPageGroup}">
	<c:choose>
		<c:when test="${requestScope.list.pagingBean.nowPage!=i}">
		<a href="noticeListForAdmin.do?pageNo=${i}">${i}</a>
		</c:when>
		<c:otherwise>
		${i}
		</c:otherwise>
	</c:choose>
</c:forEach>
&nbsp;&nbsp;
<c:if test="${requestScope.list.pagingBean.nextPageGroup}">
<a href="noticeListForAdmin.do?pageNo=${requestScope.list.pagingBean.endPageOfPageGroup+1}">▶</a>
</c:if>
<br>
<br>
</center>
</c:otherwise>
</c:choose>
